package com.socialuni.jimei.controller;

import com.socialuni.api.model.ResultRO;
import com.socialuni.sdk.factory.user.base.SocialUserDetailROFactory;
import com.socialuni.sdk.model.ProviderLoginQO;
import com.socialuni.sdk.model.RO.SocialUserDetailRO;
import com.socialuni.sdk.service.SocialUserBindAccountService;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@RestController
@RequestMapping("user")
public class UserController {
    @Resource
    SocialUserBindAccountService socialUserBindAccountService;

    @PostMapping("getMineUser")
    public ResultRO<SocialUserDetailRO> getMineUser() {
        SocialUserDetailRO userRO = SocialUserDetailROFactory.getMineUserDetail();
        return new ResultRO<>(userRO);
    }

    @PostMapping("bindProviderAccount")
    public ResultRO<?> bindProviderAccount(@RequestBody ProviderLoginQO loginQO) {
        socialUserBindAccountService.bindProviderAccount(loginQO);
        return new ResultRO<>();
    }
}